package com.lzk.validator;

import com.jfinal.core.Controller;
import com.jfinal.kit.Ret;
import com.jfinal.validate.Validator;

public class FrontUserValidator extends Validator{

	@Override
	protected void validate(Controller c) {
		setRet(Ret.fail());
		if ("/front/user/login".equals(getActionKey())) {
			validateRequired("userName", "msg", "用户名不得为空");
			validateRequired("pwd", "msg", "密码不得为空");
			validateRequired("verifyCode", "msg", "验证码不得为空");
		}
	}

	@Override
	protected void handleError(Controller c) {
		c.renderJson(getRet());
	}

}
